package pnu.ssm.broadcast;

import pnu.ssm.sbchild.SplashActivity;
import pnu.ssm.service.AppProtectService;
import pnu.ssm.service.ResurrectionService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class SBBroadCastReceiver extends BroadcastReceiver{
	
	public static final String TAG = "SBBroadCastReceiver";
	
	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		
		// intent on initial boot
		if(action.equals("android.intent.action.BOOT_COMPLETED")){
//			Intent serviceIntent = new Intent("com.myapp.MySystemService");
//			context.startService(serviceIntent);
			Intent i = new Intent(context, SplashActivity.class);
			i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(i);
		}
		// intent on
		
		else if(action.equals("pnu.ssm.intent.action.die.AppProtectService")){
			Intent i = new Intent(context, AppProtectService.class);
			context.startService(i);	
		}
		else if(action.equals("pnu.ssm.intent.action.die.RessurectionService")){
			Intent i = new Intent(context, ResurrectionService.class);
			context.startService(i);
		}
		else{
			Log.e(TAG, "");
		}
	}
}
